> ## Documentation Index
> Fetch the complete documentation index at: https://edimez14-password_generator.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Saved Password

Updates an existing saved password. Users can only update their own passwords.

## Endpoint

```
PUT /api/password-generator/view-all-saved-passwords/{pk}/update/
```

## Authentication

**Authorization** `string` *required*

Bearer token for authentication. User must be logged in.

## Path Parameters

**pk** `integer` *required*

The unique identifier (primary key) of the saved password to update.

## Request Body

All fields are optional. Only include the fields you want to update (partial update).

**password\_saved** `string`

The updated password (max 200 characters).

**url** `string`

The updated URL (max 200 characters).

**name\_pages** `string`

The updated friendly name (max 200 characters).

### Request Example

```json theme={null}
{
  "password_saved": "NewSecureP@ss789",
  "name_pages": "Updated Example Website"
}
```

## Response

### Success Response

```json 200 OK theme={null}
"data saved"
```

### Error Responses

```json 400 Bad Request theme={null}
{
  "url": ["Enter a valid URL."],
  "password_saved": ["This field may not be blank."]
}
```

```json 404 Not Found theme={null}
{
  "error": "Password not found."
}
```

```json 500 Internal Server Error theme={null}
{
  "error": "error message"
}
```

## Authorization

Users can only update passwords they own. The endpoint automatically filters by the authenticated user, ensuring users cannot update other users' passwords.

## Example Request

```bash cURL theme={null}
curl -X PUT https://api.example.com/api/password-generator/view-all-saved-passwords/1/update/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "password_saved": "NewSecureP@ss789",
    "name_pages": "Updated Example Website"
  }'
```

```javascript JavaScript theme={null}
fetch('https://api.example.com/api/password-generator/view-all-saved-passwords/1/update/', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    password_saved: 'NewSecureP@ss789',
    name_pages: 'Updated Example Website'
  })
})
.then(response => response.json())
.then(data => console.log(data));
```

```python Python theme={null}
import requests

headers = {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
}

data = {
    'password_saved': 'NewSecureP@ss789',
    'name_pages': 'Updated Example Website'
}

response = requests.put(
    'https://api.example.com/api/password-generator/view-all-saved-passwords/1/update/',
    headers=headers,
    json=data
)
print(response.json())
```

## Implementation Details

This endpoint is implemented in `views.py:90` using the `update_saved_password` view function. It supports partial updates through the `partial=True` parameter in the serializer, meaning you only need to send the fields you want to update.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.